<template>
  <a-input v-model:value="value" @change="change" />
</template>

<script>
import { reactive, toRefs } from "@vue/reactivity";
import { getCurrentInstance } from "@vue/runtime-core";

export default {
  props: {
    val: {
      type: String,
      required: true,
    },
  },
  setup() {
    let { proxy } = getCurrentInstance();

    const state = reactive({
      value: proxy.val,
    });

    const change = (val) => {
      console.log(val);
      proxy.$emit("update:val", val);
    };

    return {
      ...toRefs(state),
      change,
    };
  },
};
</script>

<style>
</style>